﻿$(function() {
	var parcelList = $('#parcelList').datagrid({
	    title:'包裹信息', 
	    fitColumns:true,
	    url:'parcel!getParcelPage?returnType=json',
	    idField:'packageId', 
	    singleSelect:false,//是否单选 
	    pagination:true,//分页控件 
	    rownumbers:true,//行号 
	    toolbar: [{
	        text: '添加', 
	        iconCls: 'icon-add', 
	        handler: function() { // 回调函数
	            var branchAddDialog = $('#branch_addDialog').dialog({
	                width: 750,
	                height: 350,
	                href: 'jsp/branch/branchAdd.jsp',
	                modal: true,
	                shadow: false,
	                title: '添加信息',
	                buttons: [{
	                    text: '确定',
	                    iconCls: 'icon-add',
	                    handler: function() {
	                    	//var id = "#lanIpAdd_Remark";
	                    	//var textVal = $(id).html();
	                   		//$(id).html(textVal.substr(0,256));
	                    	/*if(checkTextAreaVal(id)){*/
	                    		$('#branch_addForm').form('submit', {
	                    			url: 'saveOrUpateIpaddress.do?type=1',
	                    			success: function(j) {
	                    				var result = jQuery.parseJSON(j);
	                    				if (result.success) {
	                    					$("#lanIp").datagrid('reload');
	                    					$("#lanIp").datagrid('unselectAll');
	                    					$.messager.show({
	                    						title: '提示',
	                    						msg: result.msg
	                    					});
	                    					branchAddDialog.dialog('close');
	                    				} else {
	                    					$.messager.alert('提示', result.msg, 'info');
	                    				}
	                    			}
	                    		});
	                    }
	                },
	                {
	                    text: '取消',
	                    iconCls: 'icon-remove',
	                    handler: function() {
	                        $('#branch_addDialog').dialog('close');
	                    }
	                }]
	            });
	            $('#branch_addDialog').window('center');
	            /*$('#branch_addDialog').panel('move', {
	                left: 160,
	                top: 70
	            });*/
	        } 
	    }, '-', { 
	        text: '修改', 
	        iconCls: 'icon-edit', 
	        handler: function() { 
	            openDialog("branch_updateDialog","edit"); 
	        } 
	    }, '-',{ 
	        text: '删除', 
	        iconCls: 'icon-remove', 
	        handler: function(){ 
	            delAppInfo(); 
	        } 
	    }], 
	}); 
});